Finished game logic. Made small refactoring.