cleanups in javascript