Did significant refactoring on most sections. Also sped up analysis by roughly 3-fold.
Merge pull request #8 from rybern/refactoring

Did significant refactoring on most sections.