index: more comments
index: define all variables at the top

Just slightly more readable code this way.