threshold is now a parameter