implemented working version of the game