initial thread transfer implementation. TODO: debug.