refactored deferred