refactoring code architecture