Tinkering with image diffing and some refactoring