js code rectified