Refactored the main activity into view.