Refactoring of lengthy methods in Engine class.