Add deferApply
Add test for deferApply