Fixed bug where division by 0 caused threshold to become infinity.