Improved docstrings, more implementation