moved Uri building logic to its own method buildUri()