More of a nit than anything I suppose (since this code is supposed to run only once per import), but for loops are preferred to while loops and shifting the array. Most places here shifting doesn't seem necessary. http://jsperf.com/some-array-reading-comparisons/8