Added some protocol handling code.