Much improved version eliminates global variable nonsense, breaks out of
the main class, and sets us up nicely for a GUI version and Project
Euler solution.