updated code to reflect rust 0.12