Replace FIFO_ITERATE with a function