Refactor canvas module a bit