substantial js improvements