Finished problem 6