added a checker if the current item is last child. if last child method would be .prev() or else .next()