next and back function has been done