Refactoring all code