simpler implementation for #84