add getopt; clean up tree traversal; lint cleanups