Added some improvements suggested by thiez on reddit.com/r/rust

Signed-off-by: David Henningsson <david.henningsson@canonical.com>