clean code, add comments canvas.js

Remove unused code and add some comments