move template function implementations to separate header files