now performs search and updates database