Made threshold a parameter
Documentation