Cleanup of URI and argument handling