CHG: replacing overwriting function polymorphism with function template