revise discretization algorithm in imple#1