Index usability improvements2

Could this assignment move inside the `if` block?