Updated with the docstrings tidied up. No functional change.