Added problem 11. Ugly and lots of repeated code but works