added reordering functionality