Restructured and added in templating abilities