added example for finding maximum distance