Improved Rust network code