sorting and calculating reremainder are now divorced