That code is usually caused when a key on engine running test is done on an engine that is not yet at operating temperature.
If the engine was properly warmed up and not overheating, it's likely that the sensor is at fault. There is a correlation between the oil temp signal and VCT operation. The description of this relationship from the service manual is here....
If you are getting that code and the engine is at normal operating temperature, make sure the oil has been recently changed and check the oil pressure. If both are okay, you might try replacing the sensor and driving it again.
Ok, so for P0345, since you have replaced the alternator, the next step is to reprogram the PCM. Only the dealer can do this, unfortunately. I would recommend using the factory part with the correct number listed below, but at any rate get the PCM reprogrammed first. Check out the following tsb, if you have not already read it.
This article supersedes TSB 06-2-9 to add a production fix date for Expedition and Navagator and service parts updated.
Some 2005-2006 F-Super Duty and Expedition/Navigator vehicles built prior to 12/14/2005 and 2004-2005 F-150 vehicles, equipped with 5.4L 3V engine, and 2005-2006 Mustang GT vehicles, equipped with 4.6L 3V engine, may exhibit a diagnostic trouble code (DTC) P0340 and/or P0344; or 2006 Explorer 4dr/Mountaineer and 2007 Explorer Sport Trac vehicles equipped with a 4.6L 3V engine may exhibit a DTC P0345 and/or P0349. This may be due to a malfunctioning diode or open phase connection in the generator.
Perform a generator frequency test to diagnose cause of concern. Do not replace the generator unless a frequency test indicates a fault. This TSB provides step-by-step directions for performing a generator frequency test using the WDS oscilloscope function.
MANUALLY CALCULATE FREQUENCY
For the IMRC code, I'm not sure how advanced your scan tool is. You'll need a scanner that can read live data for this, but here is the pinpoint test. It's also possible that reprogramming the PCM for the other code will take care of this, I'd try that first. I'll post the pinpoint test below.
Note: If unable to fully perform the following inspections, answer NO to the question in this step.
Note: The IMRC return spring is strong. Make sure they operate properly and the plates open and close fully. On vacuum operated systems the engine must run for 20 seconds to restore vacuum then return to KOEO for testing.
Is a mechanical concern detected?
Note: IMRC return spring is strong - approximately .34 to .45 Nm (3 to 4 in-lb).
WARNING: KEEP FINGERS CLEAR OF THE MECHANISM.
Note: The vehicle must be at operating temperature and at idle for a minimum of 1 minute.
Note: If the vehicle is equipped with a vacuum-type IMRC return to Key ON Engine RUN to conduct the IMRC check. Momentarily increase the engine speed above 3,000 RPM and observe the PIDs.
IMRCM voltage values
Using the table for reference, did the IMRCM voltage values correctly change while the IMRC was cycled?
Did the IMRC levers cycle from fully closed and remain fully open while outputs were on?
Is the voltage greater than 10.5 V?
Does the test lamp illuminate?
Is the resistance less than 5 ohms?
Is the voltage less than 10.5 V?
Are the resistances greater than 10K ohms?