Port code to Rust 0.10