Removes unused code, updates docstrings