refactor dotrange to ready for middle alg
refactor