implemented Canvas class to maintain the canvas