Refactoring out subcomponents, restored some existing unit tests.