Refactoring with solution code