Refactoring of codebase