Improve documentation. Fix off-by-one errors in the SetPrevNext functions.