BDMS-472: Major rewrite.

1. Made the code OO.
2. Diffing is now done instead of just writing to separate files.
3. There is still some work to do on this.