added a set threshold method