Refactoring: moved most of game logic from view