refactoring drawing routines