modify transfer to send/receive arbitrary bytes
general format and tidy up