merging in place