problem 4 commented and tested