Second Version of the gameloop