wrote experimental distance function
switched to readFileSync