canvas context refactor