Refactored client to make UDP implementation easier.