Mostly cosmetic adding docstrings, cleaning up variable names, etc...