nit: set a onsuccess only if you have the successHandler:
```javascript
if (typeof successHandler === 'function') {
  activity.onsuccess = function() { successHandler(this.result) };
}