your exhaust leak is affecting your oxygen sensor readings. the oxygen sensor is the MOST important sensor for fuel delivery when you're in closed loop. you get a code from it because an oxygen sensor reads the difference between exhaust gas and atmospheric air. if it's reading atmospheric air, you get an incorrect reading. based on that incorrect reading, the pcm is chainging fuel trims, causing misfires and a rough idle. the sensor itself is fine. you won't be able to find a vacuum leak with any kind of brake clean check or something like that because you're already missing and your idle is trashed. fix your leak and go from there.
MAF sensor is the second most important sensor for fuel delivery. check your connectors. if the purge solenoid is stuck open and the vent solenoid is open, it's a vacuum leak in itself. the cam sensor determines which cylinder is on the compression stroke to determine which injector to fire. it'll work without it, but not well. to get what you want from it, all these need taken care of.