Refactoring to smaller methods. Should be better for JIT inlining
Rename scalar to vector

- oops, wrong name
Divide and Conquer for Maximum Distance calculation