some cleanup; mostly docstrings but also some code