refactoring for new version of rust