Fixed code to make it appropriate for the exercise