added update method with main loop of the game