revised copy of my js, in progress