Refactoring to infrastructure