added threshold option to cli and leaf? function