code cleanup in protocol bits