Get rid of some duplicate get_prev/get_next functions