Minor JS performance optimizations.