added template function to main plugin file