refactored GameEngine logic: removed 1 level of nested if..else