Cleaned up the wireup code. Added a simple integration test.