little refactor on search as it is