Added some docstrings and a couple comments