Cleanup function names. Add docstrings.