update to requestanimationframe

also stick it in a closure and add a few fixes