Optimization of js