external thresholds now accept functions (closes #173)