Moved engine code to another file