Added proper merging mechanics