better use of templating