Major changes to engine layout

fixed compiler errors. massive reorganisation. removal of bad code