moved agency sorting to searchAgency factory