Fix integration tests and cleanup a bit.