Refactoring drawing code.