refactors out mainView