rewrite main.js