simplified protocol.py in preparation for modularization