Started adding docstrings and organizing.