Solution to Task 4