Fixed non-DRY method for searching.