General cleanup

Cleanup of the boilerplate code.

I went through this with @nickyringland.