Merged midpoint functions into two (one for 2D and another for 3D), created int versions of the distance functions.