Improved viewNext function.