Answer 1c. Fixed FLATTEN issues in other scripts