Clean-up of a few things and hopefully minor documentation improvements

I made a few changes, mainly added docstrings and cleaned-up some formatting, quite minor. Perhaps you will find this to be useful.