Updated with a case switch dictionary for threshold determination.