Quarks2:pr_chooseBestVersion, and other updates part-based on miguel's pull request 4