Imported r622 of discover.sh