update the algorithm of the prev next links, and moved to see if it will stay at bottom