Changes to general structure of the program.

Some changes to the general structure of the tool have been made. The code
should now be more modular.