A few minor bug fixes; but mostly added docstrings.