Added more debugging to JS