Fixing diff mode and adding integration tests.