refactoring of games controller