Engine dies while driving. Sometimes I can pump the gas to restart. on 2006 Kia Optima

Rookie cbe0621eac06868b3efe0d8d1d3611e23c60d3114864ea2ec19a68cfbd3eebab
I originally thought it was losing electrical power but that isn't the case. It will also occasionally miss while driving, but not die.
(2) Answers
cam position sensor connector, check you codes. the connector is front top right, it gets hot from the exhaust manifold, and is brittle. replace the connector with one from a junk yard. pig tail it in.