clean up and improve some transfer code