I have a 99 grand am 2.4L and we just put a used engine in. I used all of my original stock accessories on the new engine such as, Intake manifold, exhaust manifold, throttle body etc.. We started the engine and it began to idle between 2000 rpms and 3500 rpms like someone was giving it gas and letting off. I changed the Idle control valve, throttle position sensor and map sensor, I also checked the engine grounds. I was told to drive it at least 8 miles to reset the idle control valve, didnt work. I checked for vaccuum leaks and didnt find any. I got engine codes P0507 and P0523 PLEASE HELP! I am begging. Please, Help me out guys.