Added some docstrings, changed some formatting