Improve version determination

Be a bit nicer about checking for where the version name is stored.
Also, be able to take version name from the name of the source directory.