threshold: setting and tuning (Fixes #8)