Refactoring code organization