query functionality added