Minor Refactorings

Including switch to requestAnimationFrame