moved template to server side so that it can be also used for rendering the preview