Improved request animation frame function
Refactor of adding & running animations