Clean up canvas code