Set threshold feature

As suggested by #2