Added comments and some small bug fixes in canvasrenderer