Refactoring Codebase