improve the cleanup script to actually have a chance of working