Update to use max distance parameter in the API