Working script (on Mac)