Make flatten function a variable to avoid strict mode errors.