Added some rudimentary functionality to the next and previous buttons