added code for task 6