Respond to PR comments, add docstrings and comments.