Moved various code blocks out of main.  Add hash "opt" to hold most global options.
Updated .gitignore