move template method from .cpp to the .h file