lots of changes for searching database