Fixing search and refresh functionality