You're later filling ``outcodes`` and ``outdists`` with infs. Wouldn't it be safer to do that here (memories of hard to track down random failures....)? Doesn't matter for performance I think (I'd hope that the ``fill`` method is at least as fast as a for loop compiled by Cython).