Add query and scan