A few major changes. Templating seems to work.