rewrite js