solved up to exercise 6 from multidimensional