Restructure game loop