Added requestAnimationFrame in main.js and made render and update functions