Begun implementing compare-by-content

various other small fies and improvements
Refactoring