Added the UDP protocol and fixed a few bugs.