This change avoids using the prev field in two functions that iterate over consecutive entries, so that that can easily just 'remember' the prev value instead of looking it up.
This is a small part of an effort to eventually eliminate the prev field.