Cleaned up protocol.c