Added support for tgz files
Switched to a more accurate file extension detection metho