Implemented problem 16