sort the ids here too