Carefully squeeze (1,) arrays into scalars
Add very simple test of optimizing