some js improvements