Added adjustable tolerance