Add function to get url partials and refactor the code.