Updated exercise-6 with changes from solution