cleaned up.  added docstrings