Added templated pi