Switch the while loop to a more Rust-y loop

Instead of using while !done, use Rust's loop

Fixes #969

Happy Software Freedom Day