more JS optimizations