Added examples and tol variable to function