Updated task2 solution