Implemented distance calculator