Changed indices calculation functions (like in branch 'test')