Solved problems 5 through 7