code refactoring, better main page