Wrote game loop