Switch to BTreeMap

`TreeMap` was recently removed from libcollections. These changes mimic rust-lang/rustc-serialize#3.