exercise 6
exercise 6 extra credit + typo fix