added re-ordering routine (slight hack but works)