refactored random calibration tests, found some bugs, made good changes.