the latest version before adding distance as an parameter.