; where appropriate, implemented(?) distance

Fixed line endings and implemented a slightly dysfunctional distance
equation