Modify ternary expressions to use tuple index