2004 Jeep Wrangler TJ Throttle Position Switch Issues

Ok, update on the stupid throttle position sensor issue. Changed the connector for the old factory tps sensor connector noticed some of the wires had been a little warm so I cut closer to the main harness to install the new sensor. It runs rough from time to time so the issue is still not resolved any ideas????
 
Ok, the saga appears to be over for now. Following is a list of things done the final bullet point is what resolved the issue.
1. Replaced the throttle position sensor with auto zone sensor-did not work.
2. Installed mopar throttle position sensor-better or so it seemed.
3. Checked all battery wires and changed the terminals it appeared a little better.
4. Disconnected the clock spring for airbag and horn- no change.
5. Replaced the throttle position sensor connector, factory wires were a little melted-still no change.
6 added a small diameter ground wire from the battery to the bolts holding the pcm to the firewall- issue is gone.

I will be replacing the ground straps from the rear of the motor to the body and may add another one. Check your ground as 5 volt reference to the sensors will be effected by poor grounding.