canvas stuff + refactoring