I just replaced the cam position sensor to fix an oil leak. After I got it together it cranked for a bit and started (not normal) and gave a p 0340 code which is...cam position sensor. I put the old one back on to make sure the fault wasn't with the new part and got the same problem. I didn't have this before I changed the part. There is a bit of oil in the electrical connectors and someone suggested this could be the problem and to use some mass airflow sensor cleaner to remove the oil.

Could this be it (oil contamination)? Otherwise I don't know.