Refactoring to cleanup integration