Updated code for searching.