Solution to #10, very slow, boring.