Optimize term insertion