Refactoring the main view