Cleaned up problem 6.