first steps to moving engine code into separate library