Add first part of templating code