Continuing work towards new architecture.
Code cleanup.