refactored the engine class...more