Welcome to the forum.
If you look right above your post in this Tech & Performance section you'll see a sticky that says "Error Codes".
P0340 = Camshaft Position sensor circuit
P0456 = EVAP SYSTEM SMALL LEAK
The Camshaft sensor is an easy fix if it turns out to be your problem. The small leak could be even easier if it's the gas cap not being tightened. The gas cap won't cause your stumbling, the sensor would.
Camshaft sensor - right side of the engine block.