Implement template lifecycle callbacks