added docstrings
removed unused var
added more docs