modify answer to problem 4