task 2 refactoring