generalize 'draw' a bit
reorganize all code