delete function and status change