Fixes GitHub Issue #26 - distances buffer is no longer static