reduce duplication with inheritance