begin of FIFO implementation