Reordering some logic.