task 6 and task 7 with fixes