Added script directory tracking in JS