update canvas code