Massive file refactor
Passes baseline QA