Scripts optimization