Misc fixes plus clean up of commits from runlevelsix

This depends on #22 which should be merged first.

This is a rollup of an assortment of fixes. Most of them were @runlevelsix's work, but I rebased his commits to split up whitespace and formatting changes from functional ones and fixed a few minor details along the way.