Minor JS optimizations