Code

Change tolerance to threshold