Implemented problem 7.