Refactoring drawing functions.