extracted game loop to game class