added lifecycle callbacks