Cleaned up search using helper function.