task1 refactoring