added the next button functionality