refactor buildUri method to return the uri as string directly