Create flatten.js