An exception proof distance calculator