Rewrite the main loop to always start from the head of the skiplist and deal with corner cases.