Refactoring & bug fixing related to MainModalActivity.