You need to set the CMP offset. It needs to be 0, but at least +/-2. This involves moving the distributor slightly either direction until you get the CMP offset to 0. I've seen it cause a hesitation without setting a code, and I haven't seen the code come on until its around +/-14. You'll need a scan tool that can read the CMP offset. I use the DashCommand app on my phone with a wireless scanner that plugs into the OBD port.
Ditch that distributor and get a new one. The best I've found is a billet aluminum from Summit Racing (after having nightmare issues with a couple plastic ones from NAPA). The one from the salvage yard might have a worn gear, even if it doesn't look like it. And, with the cap not being securely attached, that cap might just be floating on there. These engines are really picky about the distributor.
Also, you didn't mention changing the fuel filter, but that's a good place to start if you haven't yet. You can get a can of MAF cleaner and take care of that (assuming it's otherwise in working condition), and you can pull the plugs to see if they're fouled. Try running the engine at night in the dark and you may be able to see arcing around the distributor or wires.