treemerge: fixed a bunch of not-so-fun bugs
treemerge: added tests, so I dont screw it up again.
treemerge: removed debug prints
treemerge: removed debug print in test