made template plugin more generic