add udp code

add udp code and comments for restructuring