Lesson4: Refactoring of the previous code