updated URI function code to make it more efficient, Updated unit test