redo protocol a bit, fix json