implemented problem 2.3