Added docstrings for most functions, and modified existing docstrings to fit PEP.