Solved majority of exercise 7