Refactoring architecture