Solved problem 5, 6