Several cleanups

These are meant to increase code readability and provide useful docstrings.