Added my solution to tasks 3, 4 and 7.