Adds complicated ternary array handling