Spring Cleaning

Architecture cleanup, removed many globals, better decoupling, refactoring...