merge orders functionality