implemented reordering