did exercise 6 and fixed bug in exercise 5