introducing NonStandardDistance instead of CodeName, minor code refactoring