Simplify the mainPage handler