Changed the game loop to have a maximum frame rate.