Docstrings and a couple minor refactors.