Major refactoring to add new protocols and to match new data organization, as in Idiap DDP