(OSX) Change 'index' to 'idx' to avoid declaration of index shadows a global
declaration on OSX 10.6