Working UML generator + distance calculation