Added threshold option