Added Shah correlation, improved phase boundary smoothing.