improved extract.sh