Major code cleanups, start of an integration test