Updated to better use templating