refactored Codebase