refactoring the code base