generalized template creating