and I'd put this `if` block in the `onsuccess` handler.