smarter cleanup.sh