refactored the drawing system