optimized script API