templated the constructor