refactor main pages