Added some lifecycle methods to the activity