Code cleanup and docstring additions