Fixed pasring code and added integration test