Rewrite js code.