Eliminated singletons and modernized the code #1

Singletons make testing difficult. This update moves toward a more testable code base.