More work on the purge_deleted script