Bind reference to avoid repeated accesses by index

This makes code a bit shorter and much easier to debug. Maybe it will get a bit faster on some compilers.