Fix logging, improve handing of data, test that uses protocol.