Fixed the threshold errors. Previously stopped working when scaling.
Merge pull request #2 from mark-grimes/fixThresholdErrors

Fixed the threshold errors. Previously stopped working when scaling.