the cel from idling in traffic sounds like what my problem was/is. my conclusion lead me to the dpfe sensor.
as for the bad idle that sounds like a egr valve, that can be tested by applying vac to it and see how it effects idle. a correctly working one will not effect idle I beleive.
be systematic when you check things and you should be able to find out what is wrong