code for tasks 3 and 4