If "smells bad" means a sulfur odor like rotten eggs, that would tend to indicate a bad catalytic converter, which could also explain the poor idle if the cat is partially plugged.