Improve Next and Previous Functions of Traversal