Added tests, fixed missing application of reorder