added support for initial data transfer. Some API changes