added a constructor to template