Refactor of idsearch