Improved the way the animation loop handles time deltas