Adjustment of threshold values.

Source cleanup and formatting