series: beautify and simplify some internal functions related to term insertion.