added in-place merge