Merged measure with Jason's code and added calibrate. Fixed log bug