Improved requestAnimationFrame polyfill; fixed timer leaks; added tests

Fixes #120, among other things