added integration tests and a couple of unit tests