added previous and next buttons and functionality