detemplate factory to simplify global stuff