on large inputs, very slow b/c of O(n^2) should be smarter. At least it works