rewrite all js to be production worthy