Refactoring old code