updated code so tolerability values are correct