fixes to diff view, add some docstrings