Factored out some of the stuff cluttering draw.

This is Rafi committing.