refactor Main page