Implemented lowestDistance. Has errors.