refactored main page