Add docstrings

Add docstrings in the google format to all functions.