udp refactoring