refactor and add to search block