before refactor canvas and primitives