added next/prev code