solution to problem 24 added