refactored code base