UrlBuilder is made a template parameterised by the query format (closes #17); various related changes.