Fix not moving right range, on left corner case

+ simplify calculations a little bit