Added some logic to menu's prev and next button