Another large refactor.