adding index variables to for loops

gh-118
whitespace cleanup