changed canvas from pointer to reference