[WIP] Finish core refactor.