script optimization