Further optimizations for document insertion.