Updated the code that validates distance between two points