Ported to newer rust versions