added Query function