optimization js and partial