moved engine into own file