I have added my solution to task 4.