added thresh working