updated reset function to clear query