Add integration tests, fixes #6