Reduce complexity of merge method