More robust guessing of package name and version.

Added support for some other package naming schemes.