Refactoring to pass Integration tests