added sql/functions for delete