changed thresholding a little to follow marks logic