separated distance calculation and plotting into seperate modules