debugged the javascript