Made merging a bit smarter