class definition and template file