Updated code to match new rust version