refactoring all the code in the project