Added internal documentation
Added function docstrings
Added function docstrings