First working version of game's logic.