refactored and modularized component drawing