refactor: move the url cleaner into utility function.