Added missing direction value to distance calculations