Added template and chat functions