Fix for new minimally-sized enums

This fixes issue #106 by replacing the transmutes to enums with #[deriving(FromPrimitive)], and cleans up some of the relevant code.