Added threshold value parameter to use if threshold input port is not connected. Simplified some examples.