refactoring canvas