factored out templates