add requestAnimationFrame and other tweaks