Partial solution to challenge 13.