Cleanup

Fix up syntax errors and add docstrings everywhere.