added master game loop