Generate constructors

Also some misc cleanup.  Still not exactly easy to follow...