Added JS debugging, cleanup