Updated exercise-4 with changes from solution