is the remaining logic ok? we're working w maxDistance down here too