a little work on merge logic

removed old todo tag
added some unit tests
cleaned up some functions
Sweet, one can comment on every single line, like this one small output style improvement.
I like it.