Updated string methods and improved code logic for Uri's