Refactor component drawing functions.