Add docstrings, rename variables