minor changes problem 6