Codebase refactoring