Codebase (NewActivity)

Refactored some code in startActivity(). Improved readability and
robustness in the body of the code.