Cleaning, generalizing, abstracting

Also optimizing drawing.