Integrated the fifo and fixed compile errors.