Solution to problem 23 :)