Finish factoring cleanup_orphaned_util