Refactor a little `u_bar` function.
Add another refactoring to have `ind` variable bound only within
`for` loop in function `u_bar`.