Finished first phase of second refactor - untested and broken