Corrected some the midpoint logic and established a method for calculating the absolute distance between two points