Support fetching from prerelease library as well as from stable.
Some code cleanups as well.