added some game loop functionality