added methods and comments to Canvas.java