cleaned up mapcanvas.js to make it easier to work with