better URI parsing mechanism