task 1_2 refactored