Refactored uses of defer() to Promise()