added further tests and refactoring of game logic