Added canvas repaint and onclick event