the key is to return defer.promise