almost work version of main pages