Refactor should be more or less fully done, just needs testing.