Added solution for tasks 1 and 2.