refactoring mainview 2