Accept command line args in max_min_dist

And reorganize code in main function some.