Added write_ndx() and read_ndx(), functions that allow us to transmit