Factor out drawing routine.