added the template element as a paramater of the callback