some logic optimizations added to speed up list_dir()
prepping retry-open-handle.pl to become an official "examples" script