Update code for Ex4 Prob4