Added some logic to the page switching