Bare minimum necessary changes to make it compile on 0.9+. Ugly uses of unwrap