Added findDist function