Solved 2nd task in Section 1.2