Unfinished - improved modify_threshold