solved up to exercise 6 from methods