Updated Integration test and minor refactoring