Cleanup: use flatten1 to slightly simplify expander code