Final version of task6