Heavily refactors to make use of new definitions.

This will allow multi-tenant situations to be possible. Also adds
some basic test kitchen integration tests.