Modified template.cpp