code updated to work with Rust v-0.6