Improve activity lifecycle.