Attempt to improve JS perf