Added function that re-orders things slightly, and more appropriately