got distance calculation working