Implemented knowledge based distance calculator.