refactor main view