Merge bulk mode transfer code from Mauricio
Contreras, Andrew Tridgell and myself