Massive refactor - more abstraction, classes, DiC