Update discover.sh

More filtering of cleanup function.