separation of game loop