I could be wrong about the unplugging battery, but the cel was caused by the o2 sensors and to backtrack the only thing done was remove the front bumper and replace the headlights.
Now it may sound strange, but this can cause any number of issues, who knows.
It is taken care of.