solution to problem 12 added