improved merge so categories no longer get duplicated
added test to see that merging categories works