inplace_merge and some tests. TODO more tests