add regions and template function