updated to delete deleted records