A loose or defective gascap can cause you grief, i.e. CEL.
As far as the egr valve goes, do a search on " cleaning egr ", or " exhaust gas recirculation valve".
They do have a tendency to plug up, which does NOT necessarily mean the valve needs to be replaced.