Adjusted for new bestProb() definition
namespace std
merged Ming's test code with mine