added automatic next and previous buttons