refact mainpage