wrapping dispatch in a factory