added reorderResidue support