Simplified bencode.rs to use an iterator