Added docstrings, comments and general improvements
better docstrings