clean up javascript mess + remove cruft