Tidy up test code, improve controlTransfer logic