Implemented an improved "sigmoid" threshold function. Replaces the hard threshold.