some preparations for templating