Update to do fifo/lifo calculation