refactored main view