refactored Promise/Deferred