Extracting logic into a new class related to selecting the latest version

Also refactored InitCommand slightly so that you can use this "latest version"
functionality when searching for a package as well.