being able to use threshold as a parameter