Fixes #15 - allow setting of threshold

Set the threshold from the parameters