By `for (eindex = 0; eindex < e.Length; eindex++)` did you mean `for (eindex = 0; eindex < elen; eindex++)` ? I know it's not used further. Doesn't affect anything else. I was just reading through the code to understand it better.