reordering plus other improvements