Refactoring the drawing system