Initialise index to 0 since the algorithm seems to depend on it
Merge pull request #112 from sjoelund/uninitialised

Initialise index to 0 since the algorithm seems to depend on it
Merge pull request #113 from lbl-srg/master

Merged pull request from Martin Sjoelund