adding debug code to js script