Soltuon to problem 7. Some style cleanup on the others.