Improve and make rust 0.9 compatible