Adding discret control with threshholds
fixing bug on discrete control