exercise 6, not sure if correct though...
7 finished, seems to work alright :)