refact, use template to export classes