mostly copy/pasted the defer code so this works