api.newRequest: Define success callback outside...

...of the request config.
Better intro comments
api.edit: Fix weird indentation
Better internal management of dune object

Create at beginning, assign to it throughout the script, and then expose
it during initialisation.