Add docstrings and fix spelling errors