fixed a bug in document comparison and did some pep8 linting