here is my thoughts,,
1-you need to remove and clean the egr valve to make sure it is cloasing al the way,sense you get an egr code,you need to start here..
next,plug the vacuum to the egr valve,if it runs better then,,you will need to replace the egr solenoid[this is what the vacuum line from the egr connects to].
2-replace those pug wires,these wires are likely your problem,there is no good way to test these plug wires sense you can not duplicate the high voltage,,so replace them.
PLEASE COPY AND PASTE the link below to your browser, I have uploaded more info on this there please copy and paste the link below to your main browser[INTERNET EXPLORER or FIREFOX]
if the link doesn’t work that way, try it this way
If you are satisfied with my answer, Please Rate my answer by clicking the rating button so I can get credit for my work. I’m not always going to be giving you good news, so please don't let this stand in the way of you accepting my answer. .it does not cost you more money and we will still be able to communicate, ,.please understand, i can not see, hear or touch the vehicle and only know what you tell me. Bonuses and positive feedback are appreciated.. if you are not satisfied with my answer, please do not leave bad feed back ,i will gladly opt out and let another expert handle the question. .if i have sent any diagrams, please print them. .sometimes you may need to right click the image [,then save picture as]to save it to your computer so you can open it with your picture program...Please ask if you need more help