js rewrite, edits