JS rewrite complete