first version of the fifo implementation