Adding query and delete function.