Fixed some O(n^2) stuff, now it's running OK.