Added FIFO logic