a little work on merge logic

removed old todo tag
added some unit tests
cleaned up some functions