Solution to problem #20