Minor JS fixes

and cleanup