Heavy refactoring mid-commit pt. 2