Removed template output function and made into a plugin