Solved problem 6. -Chaz