Added requestAnimFrame function