hacked together some templating