optimization of the js part