Optimize trident implementation