change api so that we can prepare out defer object first