Engine: refactoring main loop

Renamed several functions to better reflect their meaning.