Avoid using the variable name 'index' for two completely different things.