Task 2: refactoring