added docstrings to methods and formatting