added more game logic and end state