refactoring main page