separate assembling and drawing functions and make the latter happen on requestAnimationFrame, fix bugs to make everything run nicely