debugged header/template function