Improve code reuse in .merge()