added more functional hooks in the view life cycle