Refactor MainPage code, remove unnecessary member variables