Added the main page loop