Adding arbitrary number of thresholds and output tree