updated the gameloop to be framerate independent