Switching to requestAnimationFrame