Added transmit

also fixed minor errors in rx state.
Still untested.