Refactor global options to local options.

Global options moved to main. All functions now take whatever options
they need as parameters.
Move tests. Modify tests for new functions.
Modify all function calls to explicitly state each variable.
Merge pull request #25 from rhiever/global-var-refactor

Global var refactor