Fix formatting.
Refactor Rust to use iterators instead of loops.