code for templated classes