changed decodeFn to be async