Allow the url to be specified as a function for more custom URL creation

Fixes #73 and #69