improved game loop