Factor out Canvas class