update main js code