Replace setInterval with requestAnimatinFrame