Code cleanup, added support for integration tests