I've a hunch that `i` should be initialized at 1.
Also, please fix the indentation.