added callbacks to actual template generation