Bug was calling a function with args in the wrong order. Everything works. TODO: implement my own heuristic.