Refactor main page