Added some docstrings and made some minor changes