next and back buttons working