Refactoring of the canvas drawingpath