Commenting and ording of Activity to make it easier to understand the activity lifecycle and fix some related bug. Fix some possible NullPointerExceptions.