All undefined vars at top: `var commit, i,`. The next line also looks indented incorrectly.