solution to task 2 (not finished)