Construction of a handle should probably be made into a separate function, to avoid having the same code in multiple places.

...  Have the URL be a parameter, with the default being the "http://hdl.handle.net/" bit?