DDF-231 - consolidated the next/prev code a bit