Merge pull request #216 from Dmitry-Me/removeRepeatedIndexAccesses

Bind reference to avoid repeated accesses by index