Docstrings and code style fixes

Thanks to Nicholas Tollervey for his patience.

Signed-off-by: Stephen Gran <steve@lobefin.net>