UPDATE FIXED:
So to lay it out for others, IF you get a P0340 code, replace the camshaft position sensor FIRST. It is directly underneath the oil dipstick tube on the drivers side of the front of the motor. The part number is PC462T.
Laid out:
2007 M45 has ONE Cam sensor, TWO crank sensors(sometimes called the VCT sensors), and TWO VCT solenoids (that rarely break)
The two crank/VCT sensors are the two on top. These are NOT the cam sensors, HOWEVER, you are fine replacing them with the generic cam/crank sensors from auto zone or parts plus part number PC462T.
The two solenoids are about halfway in between the top and bottom, should have nothing to do with the P0340 code.
The camshaft position sensor is all the way down underneath the oil dipstick tube. It may be easier to maneuver the intake box to obtain better access to use a ratchet. (just remove the duct above the grille with 2 screws, and remove the 2 screws on the air box.)
Now almost every sensor is new.
Thanks for the help.