added a version for fifo