added new query logic