Refactor of canvas.js into more appropriate files