edited javascript and plot