improve settings-js to generate handler once