Add query and delete functions