improved method for re-ordering the index via mutable array